<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>SM4 国密算法实现</title>

    <!-- sm4 -->
    <script src="js/sm4.js"></script>
    <script src="js/utils.js"></script>
    <script>
        message = new Array(0x01234567, 0x89abcdef, 0xfedcba98, 0x76543210);
        key = new Array(0x01234567, 0x89abcdef, 0xfedcba98, 0x76543210);
        ciphertext = KJUR_encrypt_sm4(message, key)
        console.log(ciphertext)
        for (var j = 0; j < ciphertext.length ; j++ ) {
            ciphertext[j] = parseInt(ciphertext[j], 16)
        }
        console.log(KJUR_decrypt_sm4(ciphertext,key))
        var start = new Date().getTime();
        for (var x=0; x < 1; x++){
            ciphertext = KJUR_encrypt_sm4(message,key);
            for (var i = ciphertext.length - 1; i >= 0; i--) {
                message[i] = parseInt(ciphertext[i], 16)
            };
        };
        console.log(ciphertext);
        // console.log(KJUR_decrypt_sm4(ciphertext,key));
        var end = new Date().getTime();
        console.log((end-start)/1000);
    </script>
</head>
<body>
    
</body>
</html>
